<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>Document</title>
  <style>
    textarea{width: 400px;height: 500px;}
  </style>
</head>
<body>
  <textarea id="txt1"></textarea>
  <input type="button" value="转换" id="btn">
  <textarea id="txt2"></textarea>
</body>
<script>

  var btn = document.querySelector("#btn");
  var txt1 = document.querySelector("#txt1");
  var txt2 = document.querySelector("#txt2");

  btn.onclick = function(){
    var str = txt1.value;

    // 查找html标签的正则
    var reg = /<[^>]+>/g;

    // 替换html标签
    str = str.replace(reg, "");

    txt2.value = str;
  }

  // 贪婪特性：如果正则的表描述不精准，不精确，它会尽可能的多匹配
  
</script>
</html>